package com.weishaoying.example.base.scope;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author WeiShaoying
 * @date 2018/4/3
 */
public class ScopeMain {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(JavaConfig.class);
        SingletonService singletonService = context.getBean(SingletonService.class);
        SingletonService singletonService2 = context.getBean(SingletonService.class);
        System.out.println("s1 s2 是否相同?" + singletonService.equals(singletonService2));
        PrototypeService prototypeService = context.getBean(PrototypeService.class);
        PrototypeService prototypeService2 = context.getBean(PrototypeService.class);
        System.out.println("p1 p2 是否相同?" + prototypeService.equals(prototypeService2));
    }
}
